Report Query - Visual Design

In order to create reports that can be quickly printed, saved as a PDF file, or even scheduled to be run in the evening, you must first create your Report Query. The Report Query creates the dataset that will be used by the report generator to create the report. You can create the Report Query using the visual designer or by typing out the SQL yourself in the Free Type window. The visual designer has been built to support a variety of databases. Some features of databases are proprietary are not available using the visual designer as these features are not shared by most other databases.

To read a step-by-step tutorial on how to create a Report Query, refer to Example 2 - Report Query in the Argos DataBlock Designers Guide.

 Form Designer with the Report Query tab selected.

The visual designer has the following options:

Icon Name Definition
Free type and visual designer toggle button. Free Type If you decide you would like to create your query in the Free Type editor instead, click this button. This will allow you to enter SQL directly. Note: Your query must be designed with the visual designer or with Free Type, you cannot use both for the same query. The visual designer will generate SQL statements. Be cautious when modifying these statements as your modifications will be lost if someone subsequently modifies the visual design (as the SQL will be regenerated from the visual design).
The view S Q L button. View SQL See the SQL generated from the query you built in the visual designer.
Refresh button Refresh Refresh the tables in your Query.
Copy button Copy Copies the entire visual design to the clipboard.
paste icon Paste Pastes a visual design from the clipboard. This will overwrite the existing design.
reorder tables button Reorder Tables Change the creation order of the tables on this form by moving them up or down the list. This is typically done to create a more efficient execution of the query.
edit A D O properties button Edit Query Properties Modify data connection settings. It is recommended that these settings are left set as their defaults unless otherwise instructed by an Evisions support technician.
use data dictionary toggle button Use Dictionary Turn on the use of the Data Dictionary feature.
add join button Add Join Create a custom join between tables.

Joins

When a new table is added to the visual query design, Argos examines the table meta data to determine if any pre-defined relationships exist (foreign keys). If a relationship between tables is defined by the database, Argos joins the tables (which you can then modify if desired).

To manually create a Join, select the field from one table and while holding down the mouse key, draw a line to the field in the second table that you wish to join.

By default an Inner Join is created. To edit the properties of the join, right click or double-click on the join line. Argos supports Outer right and Outer left joins.

Edit Join dialog where you select the desired join type.  Join types include Inner Join, Outer Left Join, and Outer Right Join.

Visible Fields

This image shows the Visible Fields options which includes the Visible Fields tab, the Conditional Fields tab, and Ordering tab.

There are two ways of adding a field to a query. Double clicking on a field name in the table description adds it to the end of the currently open query tab (the SELECT, WHERE, or ORDER BY clause). You can also drag and drop fields from the table description into the location you want. At this point, you should assign an alias to the field by entering a user-friendly name on the "As" line. This will be the name that is displayed to the end user. Make the name meaningful, as again, this is how the end user will refer to the field. In addition to the alias, you should assign a description. The description will be used to give more information to the end user.

You can also add a field to the query by clicking on a blank column in the current clause and selecting the desired table and field in the drop downs.

In addition to selecting a column from an existing table, there are times that you may want to reformat the data or use other built-in SQL functions (concatenate, substr, DECODE …) or even a custom function. You can create these by creating a calculated field. From the Table row of the Visible Fields (SELECT) grid, select <calculated> from the drop down list, then type your custom SQL in the Field cell, below. Because this is a calculated field, it is important to create a user-friendly alias for the field. (By default, Argos will name them "calc1", "calc2" and so on).

The following additional SQL tools are also available:

Conditional Fields

This image shows the options available when the Conditional Fields tab is selected.  Linking of conditions via and/or is illustrated.

The Conditional Fields (WHERE) tab is used to limit the query by some criteria. Fields (columns) are defined or selected the same way as described when creating the select statement (double click on the column you wish to add or select the table and field name from the drop down lists). To add the actual condition, click on the ellipsis on the Condition line and enter the condition that needs to be met.

In addition to linking conditions together using AND/OR, you can create conditional groups to help you manage more complex queries. Conditional groups can also have multiple levels of sub groups if necessary. This is depicted above in the Conditional Groups box which shows you the hierarchy of groups you have created. Selecting one of these groups or the root level will allow you to see the different conditions that have been created for that group.

Icon Name Definition
Add button Add Add a new conditional group. You can add groups at the root level or as a sub group to another group.
delete button Delete Delete the selected conditional group and all associated conditionals sub groups.
free type and visual designer toggle button Free Type / Visual Designer Toggle between Visual Design mode and Free Type. Note that this allows you to use the Visual Design for the query, but Free Type for the WHERE clause (which is typically the most complicated part of a query)..
  and/or Select AND or OR as the condition. When using AND to join conditions, the conditions on either side of the AND must be true for the record to be included in the dataset. When using OR, just one condition needs to be true for the record to be included in the dataset.
  Table Select the table from the list of tables or choose calculated to set a condition for a calculated field.
  Field Add the field. For a calculated field, click on the ellipsis button to create the condition in the SQL Editor screen.
  Condition Enter a condition or click on the ellipsis button to create the condition in the SQL Editor screen.

Conditional Fields using Free Type

This image shows the Conditional Fields tab selected when using a Free Type Query.  The work area for manually entering a query is shown.

Ordering

This image shows the Ordering tab selected with the Table, Field, and Sort options visible.

To set the sort order of the data you will need to use the Ordering (Order By) tab. This is similar to adding the Conditional fields in that you select the table and the appropriate columns. Once selected, you then tell Argos if the sort should be Ascending or Descending.

 


Need More Help?